<script setup>
const props = defineProps({
  picture: {
    type: String,
    default: '',
  },
  name: {
    type: String,
    default: '',
  },
  desc: {
    type: String,
    default: '',
  },
  price: {
    type: String,
    default: '',
  },
});
const emits = defineEmits(['click']);

const onClick = () => {
  emits('click');
};
</script>

<template>
  <div
    class="show"
    @click="onClick"
  >
    <img :src="picture">
    <div class="show-title"> {{ name }} </div>
    <p> {{ desc }} </p>
    <div class="show-price"> ￥{{ price }}</div>
  </div>
</template>

<style scoped lang="scss">
.show {
  width: 220px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s;
  padding-top: 20px;
  box-sizing: border-box;

  img {
    width: 160px;
    height: 160px;
  }

  .show-title {
    width: 160px;
    @include overflow(1);
    margin: 8px 0 12px 0;
    text-align: center;
  }

  p {
    width: 160px;
    color: #999;
    @include overflow(1);
    font-size: 14px;
    text-align: center;
  }

  .show-price {
    margin-top: 12px;
    color: #cf4444;
    font-size: 20px;
    padding-bottom: 20px;
  }

  &:hover {
    transform: translate3d(0, -3px, 0);
    box-shadow: 0 3px 8px rgb(0 0 0 / 20%);
    cursor: pointer;
  }
}
</style>
